﻿<fluent:Backstage x:Class="XSemmel.ApplicationMenu"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                  xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
                  xmlns:commands="clr-namespace:XSemmel.Commands" 
                  xmlns:Commands="clr-namespace:XSemmel.TcpListener.Commands" 
                  xmlns:XSemmel="clr-namespace:XSemmel"
                  mc:Ignorable="d" 
                  d:DesignHeight="1" d:DesignWidth="1"
                  IsOpenChanged="ApplicationMenu_OnIsOpenChanged"
                  Background="MidnightBlue"
            >
    <fluent:Backstage.Resources>
        <commands:SaveAsCommand x:Key="SaveAsCommand"/>
        <commands:NewFileCommand x:Key="NewFileCommand"/>
        <commands:NewWindowCommand x:Key="NewWindowCommand"/>
        <commands:SaveCommand x:Key="SaveCommand"/>
        <commands:QuitCommand x:Key="QuitCommand"/>
        <commands:OpenCommand x:Key="OpenCommand"/>
        <commands:OpenFromClipboardCommand x:Key="OpenFromClipboardCommand"/>
        <commands:ReloadCommand x:Key="ReloadCommand"/>
        <Commands:OpenFromTcpCommand x:Key="OpenFromTcpCommand" />
        <commands:WwwReferenceCommand x:Key="WwwReferenceCommand"/>
    </fluent:Backstage.Resources>

    <fluent:BackstageTabControl>


        <fluent:Button
            Header="New file"
            Icon="/Images/Document_blank_32x32.png"
            Command="{StaticResource NewFileCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:Button
            Header="New window" 
            Icon="/Images/Document_blank_32x32.png" 
            Command="{StaticResource NewWindowCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />

        <fluent:Button
            Header="Open..." Icon="/Images/Folder_Open_32x32.png"
            Command="{StaticResource OpenCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:BackstageTabItem>
            <fluent:BackstageTabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="/Images/Folder_Open_32x32.png" Height="16" Width="16"/>
                    <TextBlock Text="Open more" VerticalAlignment="Center" Margin="5 0 0 0"/>
                </StackPanel>
            </fluent:BackstageTabItem.Header>
            <StackPanel Orientation="Vertical">
                <fluent:Button
                    Header="Open from clipboard" Icon="/Images/OpenFromClipboard_32x32.png"
                    Command="{StaticResource OpenFromClipboardCommand}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
                />
                <fluent:Button
                        Header="Open from TCP stream" Icon="/Images/Document_TCP_32x32.png"
                        Command="{StaticResource OpenFromTcpCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
                />
                <fluent:Button
                        Header="Reload file"
                        Icon="/Images/112_RefreshArrow_Blue_32x32.png"
                        Command="{StaticResource ReloadCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
                />
                <fluent:SeparatorTabItem Header="Recent" />

                <StackPanel x:Name="_mnuOpen" x:FieldModifier="private" Orientation="Vertical" />
            </StackPanel>
        </fluent:BackstageTabItem>

        <fluent:Button
            Header="Save" Icon="/Images/SaveHH.png" 
            Command="{StaticResource SaveCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:Button
            Header="Save As..." Icon="/Images/SaveAsHH.png" 
            Command="{StaticResource SaveAsCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />

        <fluent:BackstageTabItem>
            <fluent:BackstageTabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="/Images/007_PrintView_32x32_72.png" Height="16" Width="16"/>
                    <TextBlock Text="Print" VerticalAlignment="Center" Margin="5 0 0 0"/>
                </StackPanel>
            </fluent:BackstageTabItem.Header>
            <DockPanel>
                <ContentPresenter IsVisibleChanged="_pnlPrinting_OnIsVisibleChanged" />
            </DockPanel>
        </fluent:BackstageTabItem>
          
        <fluent:SeparatorTabItem Header="" />

        <fluent:BackstageTabItem>
            <fluent:BackstageTabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="/Images/w3.png" Height="16" Width="16"/>
                    <TextBlock Text="w3schools Reference" VerticalAlignment="Center" Margin="5 0 0 0"/>
                </StackPanel>
            </fluent:BackstageTabItem.Header>
            <StackPanel Orientation="Vertical">
                <fluent:Button
                    Header="XML Schema Reference"
                    Icon="/Images/w3.png"
                    Command="{StaticResource WwwReferenceCommand}"
                    CommandParameter="http://www.w3schools.com/schema/schema_elements_ref.asp"
                />
                <fluent:Button
                    Header="XPath Reference"
                    Icon="/Images/w3.png"
                    Command="{StaticResource WwwReferenceCommand}"
                    CommandParameter="http://www.w3schools.com/xpath/xpath_functions.asp"
                />
                <fluent:Button
                    Header="XQuery Reference"
                    Icon="/Images/w3.png"
                    Command="{StaticResource WwwReferenceCommand}"
                    CommandParameter="http://www.w3schools.com/xquery/xquery_reference.asp"
                />
                <fluent:Button
                    Header="XSLT Reference"
                    Icon="/Images/w3.png"
                    Command="{StaticResource WwwReferenceCommand}"
                    CommandParameter="http://www.w3schools.com/xsl/xsl_w3celementref.asp"
                />
            </StackPanel>
        </fluent:BackstageTabItem>
    
        <fluent:SeparatorTabItem Header="" />
    
        <fluent:Button
            Header="Options"
            Icon="/Images/Gear_16x16.png"
            Click="btnOptions_Click"
        />
        <fluent:BackstageTabItem>
            <fluent:BackstageTabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="/Images/109_AllAnnotations_Info_16x16_72.png" Height="16" Width="16"/>
                    <TextBlock Text="About" VerticalAlignment="Center" Margin="5 0 0 0"/>
                </StackPanel>
            </fluent:BackstageTabItem.Header>
            <XSemmel:AboutBox/>
        </fluent:BackstageTabItem>

        <fluent:Button
            Header="Exit"
            Icon="/Images/305_Close_16x16_72.png"
            Command="{StaticResource QuitCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />

    </fluent:BackstageTabControl>

</fluent:Backstage>
    
